home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / General / LineShare Folder / Put Onto Productions Disks / LineShare Scripts / Prometheus FaxVoiceData < prev    next >
Text File  |  1993-12-17  |  5KB  |  265 lines

  1. ! Version 2.1
  2. !
  3. !$ Use with: Prometheus Home Office modems.
  4. !
  5. !$ Supports: MaxFax voice/fax and AppleTalk Remote Access.
  6. !
  7. !$ In MaxFax, set "Rings till answer" to 1, "Toll Saver" to 0.
  8. !
  9. !$To access the ARA server, extend the phone number with
  10. !$ 8 commas and 1-3 "Data Link Codes" separated with commas.
  11. !
  12. !$ Sample: "555-234,,,,,,,,5,5,5".
  13.  
  14. ^2 Speaker On:        = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
  15. ^3 Speaker Volume:       = Enum("Low"="1","Medium"="2","High"="3") "2"
  16. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  17. ^5 Fax Identifier:    = Text "Stalker"
  18. ^6 Handshake wires:   = Bool("CTS/RTS"="&D0\Q3","CTS only"="&D2\Q2") "&D2\Q2"
  19. ^7 Data Line Code:    = Enum("1"="","2"="","3"="","4"="","5"="","6"="","7"="","8"="","9"="") ""
  20. ! ------------------------------------------
  21. ! Resetting the modem:
  22. ! ------------------------------------------
  23. @Hangup
  24.   Note "Resetting" 3
  25.   SetTries 2
  26.   Flush
  27.   HsReset 0,0,17,19,0,0
  28. !
  29. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  30. ! to enter the command mode
  31. !
  32. @Label 1
  33.   matchclr
  34.   matchstr 1 2 "OK\r\n"
  35.   write "ATH0&F\r"
  36.   matchread 20
  37.   Write "+++"
  38.   DtrClear
  39.   pause 5
  40.   DtrSet
  41. !
  42.   SerReset 19200,0,8,1
  43.   DecTries
  44.   IfTries 1 1
  45.   SerReset 9600,0,8,1
  46.   IfTries 0 1
  47. !
  48. ! OSErr -6019 "Modem error - the modem is not responding"
  49. !
  50.   exit -6019
  51. @Label 2
  52.   SerReset 9600,0,8,1
  53.   write "AT+FCLASS=0\r"
  54.   Jsr 100
  55.   write "AT+FAA=0\r"
  56.   Jsr 100
  57.   exit 0
  58.  
  59. ! ------------------------------------------
  60. !    Receiving incoming calls
  61. ! ------------------------------------------
  62. @ANSWER
  63. !
  64. ! Set the modem preferred speed first
  65. !
  66.   SerReset 9600,0,8,1
  67.   Jsr 80
  68. @Label 10
  69. !
  70. ! Set the common options
  71.   Jsr 70
  72.  
  73.   Write "AT+FAA=1\r"
  74.   Jsr 100
  75. !
  76. ! Everything is ready - let's sit and wait for a call
  77. ! We'll wait for 5 minutes, then reinitiate the modem
  78. !
  79.   Note "Waiting for a fax/voice or ARA call…"
  80.   SetTries Val("^4")
  81. @Label 15
  82.   MatchClr
  83.   matchstr 1 16 "RING\r\n"
  84.   Matchread 3000
  85.   jump 10
  86. @Label 16
  87.   Note "Ring…"
  88.   DecTries
  89.   IfTries 1 15 
  90.  
  91. ! A = <dle> 0x11 <digit code>
  92. ! B = 0x1F (* code)
  93. !
  94.   SetVar A "\16\17^7"
  95.   SetVar B "\31\r\nOK\r\n"
  96.   QueueInput "\r\nRING\r\n\r\nRING\r\n"
  97.   Attach "MaxFax" (DTR,Escape,Master,Check(A,B))
  98.   Pause 5
  99. !
  100. !now abort greetings, if any in progress
  101.   Write "\16\03"
  102.   MatchClr
  103.   MatchStr 1 17 "OK\r\n"
  104.   MatchRead 40
  105. @Label 17
  106. !
  107. ! switch off voice modes
  108.   Write "AT#VS0\r"
  109.   Jsr 100
  110.   SerReset 9600,0,8,1
  111.  
  112.   Write "AT#VH0\r"
  113.   Jsr 100
  114.  
  115.   Write "AT+FAA=0\r"
  116.   Jsr 100
  117. !
  118. ! Set the common options
  119.   Jsr 70
  120. !
  121. ! Set ARA parameters, force to answer in the data mode
  122.   Write "AT\\N0W1A\r"
  123.   MatchClr
  124.   MatchStr 1 20 "\r\nCARRIER "
  125.   MatchStr 4 93 "NO CARRIER\r\n"
  126.   MatchStr 5 94 "NO ANSWER\r\n"
  127.   MatchRead 300
  128.   Write "\r"
  129.   Exit -6019
  130.  
  131. @Label 20
  132.   QueueInput "\r\nCARRIER "
  133.   ifOriginate 21
  134.   QueueInput "\r\nRING\r\n"
  135. @Label 21
  136.   Attach "ARA" (DTR,Escape,TimeLimit=0)
  137.  
  138. ! ------------------------------------------
  139. ! Originating a call through the "ARA" subport
  140. ! ------------------------------------------
  141. @ORIGINATE "ARA"
  142.   SerReset 9600,0,8,1
  143.   Jsr 80
  144. !
  145. ! Set the common options
  146. !
  147.   Jsr 70
  148. !
  149. ! Set the Data mode:
  150. ! • \N0 Normal connection (no compression, correction - for ARA)
  151. ! • W1:  report connection rate
  152. !
  153.   Write "AT\\N0W1\r"
  154.   Jsr 100
  155. !
  156. ! Prepare to receive all error result codes, dial the number
  157. !
  158.   Jsr 90
  159.   MatchStr 1 20 "\r\nCARRIER "
  160.   MatchRead 1000
  161.   Write "\r"
  162.   Exit -6019
  163.  
  164. ! ------------------------------------------
  165. ! Originating a call through the "MaxFax" subPort
  166. ! ------------------------------------------
  167. @ORIGINATE "MaxFax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
  168. !
  169. ! Set the "Fax" speed
  170. !
  171.   SerReset 9600,0,8,1
  172.   Jsr 80
  173. !
  174. ! Set the common options
  175. !
  176.   Jsr 70
  177. !
  178. ! Set the Fax mode
  179. !
  180.   Write "AT+FCLASS=2\r"
  181.   Jsr 100
  182.   SetSpeed 19200
  183. !
  184. ! Now emit all commands that the application has sent to that port, except +FCLASS
  185. !
  186.   EmitClear "+FCLASS"
  187.   Jsr 60
  188. !
  189. ! Prepare to receive all error result codes, dial the number
  190. !
  191.   Jsr 90
  192.   HSReset 0 1 0 0 0 0
  193.   MatchStr 1 30 "\r\n+FCON"
  194.   MatchRead 900
  195.   Write "\r"
  196.   Exit -6019
  197. !
  198. ! This section emits all modem commands sent from the client application
  199. ! For each set of commands the "OK" answer is awaited
  200. !
  201. @Label 60
  202.   EmitStart
  203. @Label 61
  204.   EmitCommand 62
  205.   Jsr 100
  206.   Jump 61
  207. @Label 62
  208.   return
  209. !
  210. ! This section initiates the modem before ANSWER and ORIGINATEs:
  211. ! extended responses + connect at the highest rate + speaker control +
  212. ! reset on Dtr drop 
  213. ! Verbal responses mode, no echo 
  214. !
  215. @Label 70
  216.   Write "ATX4M^2L^3^6V1E0\r"
  217.   Jsr 100
  218.   return 
  219.  
  220. !
  221. ! This section syncronize the modem after the serial port speed switching
  222. !
  223. @Label 80
  224.   ChrDelay 1
  225.   Write "AT\r"
  226.   ChrDelay 0
  227.   Jsr 100
  228.   return
  229. !
  230. ! Prepare to receive error result codes, send the dialing command and
  231. ! set the user's handshake mode
  232. !
  233. @Label 90
  234.   MatchClr
  235.   MatchStr 2 91 "NO DIALTONE\r\n"
  236.   MatchStr 3 92 "BUSY\r\n"
  237.   MatchStr 4 93 "NO CARRIER\r\n"
  238.   MatchStr 5 94 "NO ANSWER\r\n"
  239.   Write "ATD^1\r"
  240.   HsReset *
  241.   return
  242. @Label 91
  243.   exit -6020
  244. @Label 92
  245.   exit -6022
  246. @Label 93
  247.   exit -6021
  248. @Label 94
  249.   exit -6023
  250. !
  251. ! Processing the AT command:
  252. ! OK -> proceed
  253. ! ERROR or TimeOut ->exit -6019
  254. ! It can be called AFTER the "Write" command, since LineShare buffers input
  255. !
  256. @Label 100
  257.   MatchClr
  258.   MatchStr 1 102 "\r\nOK\r\n"
  259.   MatchStr 2 101 "\r\nERROR\r\n"
  260.   MatchRead 20
  261. @Label 101
  262.   Exit -6019
  263. @Label 102
  264.   return
  265.